package 笔试;

import java.util.Scanner;

public class 排队 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int id = scan.nextInt();
        scan.nextLine();
        int[][] midd = new int[n][m];
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < m; j++) {
                midd[i][j] = scan.nextInt();
            }
            scan.nextLine();
        }
        int[] sum = new int[n];
        int tmp = 0;
        while(tmp < n) {
            for(int i = 0; i < m; i++) {
                sum[tmp] += midd[tmp][i];
            }
            tmp++;
        }
        int resTmp = sum[id-1];
        int res = 1;
        for(int i = 0; i < n; i++) {
            if(i == id-1) {
                continue;
            }
            if(resTmp < sum[i]) {
                res++;
            }
            if(resTmp == sum[i] && i < id-1) {
                res++;
            }
        }
        System.out.println(res);
    }
}
